package test2

import "fmt"

type Number1 interface {
	Equal(i int) bool
	LessThan(i int) bool
	MoreThan(i int) bool
}

type Number2 interface {
	Equal(i int) bool
	LessThan(i int) bool
	MoreThan(i int) bool
	Add(i int)
}
func (n *Number) Add(i int) {
	*n = *n + Number(i)
}

type Number int
func (n Number) Equal(i int) bool {
	return int(n) == i
}

func (n Number) LessThan(i int) bool {
	return int(n) < i
}

func (n Number) MoreThan(i int) bool {
	return int(n) > i
}

func Test3() {
	// 类
	var num1 Number = 1
	// 实例赋值给接口
	var num2 Number2 = &num1
	// 接口赋值给接口
	var num3 Number1 = num2
	fmt.Println(num3, num2, num1)

}
